﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LINQExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            
        }

        public void KindofMain()
        {
            List<Experiment> tempList = Experiment.Init();

            //var condt = new Func<Experiment, bool>(IsFirst);
            //var first = tempList.Where(condt);

            var first = tempList.Where(delegate(Experiment exp) { return exp.Id == 1; });

            Func<Experiment, bool> delegateFunc = delegate(Experiment exp) { return exp.Id == 1; };
            Func<Experiment, bool> lambdaExp = b => b.Id == 1;
        }

        public bool IsFirst(Experiment exp)
        {
            return (exp.Id == 1);
        }
    }

    public class Experiment
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Surname { get; set; }

        public static List<Experiment> Init()
        {
            List<Experiment> tempList = new List<Experiment>();

            Experiment expObj = new Experiment();
            expObj.Id = 1;
            expObj.Name = "Ahmet";
            expObj.Surname = "Demir";
            tempList.Add(expObj);
            Experiment expObj2 = new Experiment();
            expObj2.Id = 2;
            expObj2.Name = "Mehmet";
            expObj2.Surname = "Demir";
            tempList.Add(expObj2);
            Experiment expObj3 = new Experiment();
            expObj3.Id = 3;
            expObj3.Name = "Faruk";
            expObj3.Surname = "Demir";
            tempList.Add(expObj3);
            Experiment expObj4 = new Experiment();
            expObj4.Id = 4;
            expObj4.Name = "Ahmet";
            expObj4.Surname = "Hasan";
            tempList.Add(expObj4);
            Experiment expObj5 = new Experiment();
            expObj5.Id = 5;
            expObj5.Name = "Salih";
            expObj5.Surname = "Uyguz";
            tempList.Add(expObj5);

            return tempList;
        }
    }
}
